package com.zju.DoctorGo.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.zju.DoctorGo.entity.Diagnosis;
import com.zju.DoctorGo.entity.Patient;
import com.zju.DoctorGo.mapper.DiagnosisMapper;
import com.zju.DoctorGo.mapper.PatientMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DoctorService {

    @Autowired
    private PatientMapper patientMapper;

    @Autowired
    private DiagnosisMapper diagnosisMapper;

    public List<Patient> getPatientsByDoctorId(Integer doctorId) {
        return patientMapper.selectList(new QueryWrapper<Patient>().eq("doctor_id", doctorId));
    }
    public List<Diagnosis> getDiagnosesByDoctorId(Integer doctorId) {
        QueryWrapper<Diagnosis> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("doctor_id", doctorId);
        return diagnosisMapper.selectList(queryWrapper);
    }

}
